#define _CRT_SECURE_NO_WARNINGS 1
#include "Snake.h"

void Game()
{
	Snake s = { 0 };
	int ch = 0;
	do
	{
		//游戏的初始化
		GameInit(&s);

		//游戏运行
		GameRun(&s);

		//游戏结束
		GameOver(&s);
		s._pSnake = NULL;

		Sleep(1000);
		system("cls");
		SetPos(35, 12);
		printf("Do you want another round?");
		SetPos(45, 13);
		printf("Y/N");
		ch = _getch();
	} while (ch == 'Y' || ch == 'y');
}

int main()
{
	//程序一开始就先设置本地化
	setlocale(LC_ALL, "");

	srand((unsigned int)time(NULL));

	//游戏运行逻辑
	Game();
	system("cls");
	SetPos(37, 12);
	printf("Exit the game");
	SetPos(0, 25);
	return 0;
}